Detecting abnormal item removal in automated storage systems requires more than simple threshold comparison. In the Smart Shoes Shelves System, a fuzzy logic-based weight monitoring algorithm was implemented on ESP32 to improve anomaly detection accuracy.

Figure 3 – Mechanical smart shelf structure integrated with load cell-based weight monitori.png

Unlike conventional systems that trigger alarms when weight drops below a fixed limit, this design evaluates both weight deviation and rate of change to reduce false positives caused by vibration, gradual handling, or sensor noise.

System Architecture Overview

image.png

The hardware consists of:

  • ESP32 microcontroller
  • Load cell sensor
  • HX711 24-bit ADC amplifier
  • LCD 16x2 I2C
  • Buzzer alarm
  • Firebase integration

The board layout and component placement are shown in the Board Details section, highlighting integration between sensor input, LCD interface, and ESP32 core processing.

image.png

The system continuously measures weight (Present Value / PV) and compares it to a stored setpoint (SP).

Mathematical Foundation

The fuzzy system is based on two input variables:

Error:

image.png

Delta Error:

image.png

Where:

  • SP = Setpoint weight
  • PV = Current measured weight
  • ΔE = Rate of weight change

This allows detection of sudden removal events versus gradual user interaction.

Membership Function Design & Rule Base Implementation

Error membership sets:

  • NB (Negative Big)
  • NS (Negative Small)
  • ZO (Zero)
  • PS (Positive Small)
  • PB (Positive Big)

Delta Error membership sets:

  • NB
  • NS
  • ZO
  • PS
  • PB

The interval resolution used:

  • Error interval = 0.5
  • Delta error interval = 0.2

Triangular membership functions were used for smooth transitions between states.

This prevents rigid decision boundaries.

Figure 5 – Fuzzy rule evaluation matrix defining system output behavior..png

The rule evaluation matrix defines output behavior:

Output categories:

  • Normal
  • Warning + Notification
  • Alarm & Notifications

Example rule:

IF Error = NB

AND Delta Error = NB

THEN Output = Alarm & Notification

This rule detects sudden significant weight removal.

Defuzzification is implemented using a singleton method with output values:

  • 0 → Normal
  • -1 → Warning
  • -2 → Alarm

Firmware Implementation on ESP32

image.png

Implementation steps:

  1. Read HX711 value
  2. Apply filtering (moving average)
  3. Compute error and delta error
  4. Calculate membership degrees
  5. Evaluate fuzzy rules
  6. Compute weighted output
  7. Trigger buzzer and Firebase alert

The calibration process ensures accurate weight measurement before fuzzy evaluation begins.

System Behavior

When a correct item is removed through the application interface, the setpoint is updated dynamically.

image.png

However, if weight changes without proper command sequence, the fuzzy engine evaluates the anomaly and activates the alarm state.

This dynamic adaptation significantly reduces false alarms compared to static threshold methods.

Engineering Insight

The integration of fuzzy logic into an embedded IoT platform demonstrates how lightweight AI techniques can enhance reliability in real-world systems.

Instead of binary logic, the system operates using graded decision-making, making it more robust against:

  • Mechanical vibration
  • Sensor drift
  • Gradual load changes
  • Minor noise fluctuation

This approach bridges classical embedded programming with intelligent decision systems, suitable for smart inventory, anti-theft storage, and automated monitoring environments.

#AI# #Fuzzy# #Embedded#

#AI#
#Fuzzy#
#Embedded#
IoT Project

No comments yet. Be the first to comment!